package com.example.purchase.network.service;

import com.example.purchase.bean.BaseBean;
import com.example.purchase.bean.DataBean;
import com.example.purchase.bean.HotBean;
import com.example.purchase.bean.MainBean;
import com.example.purchase.bean.PersonalBean;

import java.io.File;
import java.lang.reflect.Array;
import java.util.List;

import io.reactivex.rxjava3.core.Flowable;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface HttpService {

    @GET("ticket/banner")
    Flowable<BaseBean<List<DataBean>>> getBanner();

    @GET("/user/sms/{phone}")
    Flowable<BaseBean<List<DataBean>>> sendCode(@Path("phone") String phone);

    @GET("/ticket/list")
    Flowable<BaseBean<List<MainBean>>> getTicketList(@Query("city") String city, @Query("sort") String sort, @Query("status") String status, @Query("page") String page,@Header("Authorization") String access_token);

    @GET("/ticket/hot")
    Flowable<BaseBean<List<HotBean>>> getHotTicketList();

    @GET("/ticket/{id}")
    Flowable<BaseBean<MainBean>> getTicketDetail(@Path("id") String id , @Header("Authorization") String access_token);

    @GET("/ticket/search")
    Flowable<BaseBean<List<MainBean>>> getSearchTicket(@Query("page") String page , @Query("input") String input , @Header("Authorization") String access_token);

    @GET("/user/userinfo")
    Flowable<BaseBean<PersonalBean>> getUserInfo(@Header("Authorization") String access_token);

    @GET("/admin/ticket")
    Flowable<BaseBean<List<MainBean>>> getAdminTicket(@Query("page") String page , @Header("Authorization") String access_token);

    @POST("/ticket/like")
    Flowable<BaseBean<String>> like(@Query("id") String id , @Header("Authorization") String access_token);

    @POST("/user/login")
    Flowable<BaseBean<String>> loginUser(@Query("phone") String phone , @Query("smsCode") String pass);

    @POST("/user/headImg")
    Flowable<BaseBean<List<DataBean>>> updateHeader(@Query("img") File image , @Header("Authorization") String access_token);

    @POST("/admin/login")
    Flowable<BaseBean<String>> loginAdmin(@Query("username") String username , @Query("password") String password);

    @Multipart
    @PUT("/user/username")
    Flowable<BaseBean<String>> updateUserName(@Part("username") String username , @Header("Authorization") String access_token);

    @DELETE("/admin/ticket")
    Flowable<BaseBean<String>> deleteTicket(@Query("id") String id , @Header("Authorization") String access_token);
}